<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<ul>
		  <li>右键菜单项1</li>
		  <li>右键菜单项2</li>
		  <li>右键菜单项3</li>
			<li>右键菜单项4</li>
			<li>右键菜单项5</li>
			<li>右键菜单项6</li>
		</ul>
		<script>
		  let ulObj = document.getElementsByTagName('ul')[0];
		  ulObj.style.border = 'solid 1px #666';
		  ulObj.style.width = '100px';
		  ulObj.style.position = 'absolute';
		  ulObj.style.display = 'none';
		  document.oncontextmenu = function(event){
		    ulObj.style.display = 'block';
		    ulObj.style.left = event.clientX+'px';
		    ulObj.style.top = event.clientY+'px';
		    event.preventDefault();
		  }
		  ulObj.onclick = function(){
		    this.style.display = 'none';
		  }
		</script>
	</body>
</html>